home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / tools / profiler / tcprof / tcprof.doc next >
Encoding:
Text File  |  1988-10-04  |  40.2 KB  |  1,239 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.                      Turbo C profiler (TCPROF version 1.5)
  34.                         Copyright (C) 1988 Andre Nancoz
  35.                               all rights reserved
  36.  
  37.  
  38.  
  39.  
  40.  
  41.                                Contents
  42.  
  43.  
  44.  
  45.           INTRODUCTION                                               1
  46.              Overview  . . . . . . . . . . . . . . . . . . . . . . . 1
  47.              History . . . . . . . . . . . . . . . . . . . . . . . . 1
  48.              Copyright information . . . . . . . . . . . . . . . . . 1
  49.              Trademark information . . . . . . . . . . . . . . . . . 1
  50.              System requirements . . . . . . . . . . . . . . . . . . 2
  51.              Compilation and execution requirements  . . . . . . . . 2
  52.              Restrictions and caveats  . . . . . . . . . . . . . . . 2
  53.  
  54.           USING THE PROFILER                                         4
  55.              Executing the profiler  . . . . . . . . . . . . . . . . 4
  56.              Profiler options  . . . . . . . . . . . . . . . . . . . 4
  57.  
  58.           INPUT/OUTPUT                                               6
  59.              File usage  . . . . . . . . . . . . . . . . . . . . . . 6
  60.              Report content  . . . . . . . . . . . . . . . . . . . . 6
  61.  
  62.           MEMORY USAGE                                               9
  63.              Lines within functions  . . . . . . . . . . . . . . . . 9
  64.              Functions only  . . . . . . . . . . . . . . . . . . . . 9
  65.  
  66.           ERROR MESSAGES                                            10
  67.  
  68.           APPENDIX A                                                11
  69.              LISTING 1..............................................11
  70.              EXAMPLE 1..............................................12
  71.              EXAMPLE 2..............................................13
  72.  
  73.           APPENDIX B                                                14
  74.              Registered user information . . . . . . . . . . . . . .14
  75.              Registered user features  . . . . . . . . . . . . . . .14
  76.  
  77.           APPENDIX C                                                17
  78.              PROBLEM REPORT/SUGGESTIONS  . . . . . . . . . . . . . .17
  79.              REGISTERED USER ORDER FORM  . . . . . . . . . . . . . .18
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.                                        i
  103.  
  104.  
  105.  
  106.                              INTRODUCTION
  107.  
  108.  
  109.      Overview
  110.  
  111.           TCPROF will show you where the most time is being spent in a
  112.           program  written with Borlands' Turbo C.  The output report
  113.           indicates the percentage of time (numerically and
  114.           graphically) spent in each function and line of your program.
  115.           Several options allow you to vary the amount of information
  116.           shown on the report.  No changes to your source code are
  117.           required in order to run the profiler.  The hardware timer is
  118.           read but not modified.
  119.  
  120.           This program is distributed at no charge and is designed for
  121.           users who have an occasional need or curiosity about the
  122.           efficiency of their programs.  A registered user version of
  123.           this program (TCPROFRU) is available which allows more
  124.           extensive tailoring of the output and can reduce the amount
  125.           of overhead and size of the report (See Appendix B for more
  126.           information).
  127.  
  128.  
  129.      History
  130.  
  131.           Version 1.0   First release.
  132.  
  133.           Version 1.5   Update for Turbo C release 2.0.  Timing logic
  134.                         change to increase consistency.
  135.  
  136.  
  137.      Copyright information
  138.  
  139.                 Turbo C profiler program TCPROF and documentation
  140.                        Copyright (C) 1988 by Andre Nancoz
  141.                                all rights reserved
  142.  
  143.           The Turbo C profiler is not public domain software.  TCPROF
  144.           and it's accompanying documentation may be distributed freely
  145.           provided no fee is charged and it is not part of a package
  146.           for which a charge is made.  Furthermore, the program and
  147.           documentation must be distributed with no modifications.
  148.  
  149.           TCPROF is distributed as-is with no expressed or implied
  150.           warranties.
  151.  
  152.  
  153.      Trademark information
  154.  
  155.           Turbo C is a trademark of Borland International Inc.
  156.           IBM-PC is a trademark of International Business Machines
  157.           Corporation.
  158.           MS-DOS is a trademark of Microsoft Corporation.
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. October 4, 1988                                                 INTRODUCTION - 1
  168.  
  169.  
  170.  
  171.  
  172.      System requirements
  173.  
  174.           IBM-PC and true compatibles.
  175.           MS-DOS version 3.0 or above.
  176.           Minimum memory required is 39K above that required for the
  177.           program being profiled.  Additional memory may be required
  178.           depending on the program being profiled.  See the section on
  179.           memory usage for more information.
  180.  
  181.  
  182.      Compilation and execution requirements
  183.  
  184.           In order to run a program under the profiler the program must
  185.           be compiled with, at least, the following options:
  186.  
  187.           TCC command line;
  188.             -y generate line numbers in .obj file.
  189.             -M full link map.
  190.  
  191.           TLINK command line;
  192.             /m or /s to generate a link map.
  193.             /l output line numbers in link map.
  194.  
  195.           Integrated Development Environment;
  196.             O/C/Code generation/Line numbers..On
  197.             O/L/Map file..Publics or Detailed
  198.  
  199.           NOTE:  Line numbers and map options are required even if the
  200.           functions only option is used.
  201.  
  202.           When running the profiler the .EXE and the .MAP file must be
  203.           available using the standard DOS search path, i.e. the
  204.           current directory of the current drive is checked first.  If
  205.           not found, each directory in the environment PATH is checked.
  206.  
  207.  
  208.      Restrictions and caveats
  209.  
  210.           Timer
  211.           If your program steals the timer interrupt it must chain to
  212.           the previous owner of the interrupt.  The profiler does NOT
  213.           modify the timer rate but does read the timer chip.  If your
  214.           program modifies the timer rate the profiler may still
  215.           operate correctly.
  216.  
  217.           Single Step and Interrupt 3
  218.           If your program uses these, the profiler will not work
  219.           correctly.  It may be reboot time.
  220.  
  221.           longjmp
  222.           Likely to mess up timing.
  223.  
  224.           Static functions
  225.           All line numbers for a function defined as static will be
  226.           included with the last non-static function.  This will likely
  227.           cause the warning message regarding inaccurate timing.  The
  228.           profiler keeps track of entrances to and exits from
  229.  
  230.  
  231.  
  232.  
  233.                                                                 INTRODUCTION - 2
  234.  
  235.  
  236.  
  237.  
  238.           functions.  Since static function addresses do not appear in
  239.           the link map the profiler does not have an accurate
  240.           indication of where the static function began or where the
  241.           previous non-static function ended.
  242.  
  243.           Assembler
  244.           Assembler modules should be assembled without the line number
  245.           option(TASM /ZD).  The profilers' timing resolution cannot
  246.           handle interrupts at each machine instruction.
  247.  
  248.           Unlike previous versions of Turbo C, version 2.0 passes the
  249.           line number option on to TASM when inline assembler is used.
  250.           When a single machine instruction is generated for a line of
  251.           C source it is likely that they will be reported as 0% due to
  252.           the profilers timing resolution.  Some functions such as
  253.           enable(), disable(), etc. will cause the same problem.  Use
  254.           of the emit() function to output one instruction per line
  255.           will also cause the problem.
  256.  
  257.           If you are using previous versions of Turbo C, use of the asm
  258.           keyword within a C module will cause no line numbers to be in
  259.           the map, TCC invokes MASM without the line number option.
  260.           Therefore, functions which contain the asm keyword should be
  261.           compiled in a separate module from functions which you wish
  262.           to time.
  263.  
  264.           TSRs
  265.           I have tested the profiler with several TSRs with no
  266.           problems.  The timing may be different for the same program
  267.           depending on which TSRs are loaded.  Therefore, in order to
  268.           compare results of two profiler runs, the same environment
  269.           should be used for each run.  Of course activating a TSR
  270.           during a profiler run would disturb the timing.
  271.  
  272.           Bugs
  273.           This program is not a debugger and expects a reasonably
  274.           behaved program.  The profiler may be useful in detecting
  275.           some problems such as loops or functions executing the wrong
  276.           number of times or not executing at all, etc.
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.                                                                 INTRODUCTION - 3
  300.  
  301.  
  302.  
  303.  
  304.                           USING THE PROFILER
  305.  
  306.  
  307.      Executing the profiler
  308.  
  309.           TCPROF [prof options] program-name [program-name options]
  310.             The brackets [] denote optional information, they are
  311.             not entered.
  312.  
  313.           If the program-name is not entered, help information is
  314.           displayed.
  315.  
  316.           Program-name options are passed to program-name in the same
  317.           manner as if the program was executed stand-alone.  The
  318.           argv[0] parameter contains program-names' full path.  The
  319.           profiler report is written to stdout, any redirection applies
  320.           to both program-name and the profiler report.  The profiler
  321.           uses stderr for error messages which cause it to abort the
  322.           run, also for a few messages to the console when stdout is
  323.           redirected.
  324.  
  325.  
  326.      Profiler options
  327.  
  328.           Profiler options may be entered in upper or lower case.  The
  329.           leading character may be either a - or a /.  All profiler
  330.           options must precede the name of the program to be profiled.
  331.  
  332.           -F            Profile by function.  The default is a detailed
  333.                         report by line number within function.  Using
  334.                         this option creates an output report with only
  335.                         one line per function and substantially reduces
  336.                         the profiler overhead when your program is
  337.                         running.
  338.  
  339.  
  340.           -Cnn          Print only lines whose execution count is equal
  341.                         to or greater than nn. The default value is 0.
  342.                         This option only influences the amount of
  343.                         report output.  The option has no effect if the
  344.                         -F option is chosen.  The nn is interpreted as
  345.                         an unsigned long integer.
  346.  
  347.           -Lnn          Number of lines per page.  The default is 25.
  348.                         If nn is omitted, 0 or an invalid number, the
  349.                         default is 58 (a good value for 8.5 inch
  350.                         printed output).  This option does not change
  351.                         the "pause between each page" output action,
  352.                         which is controlled by whether or not stdout
  353.                         has been redirected.
  354.  
  355.           -Snn          This option controls an internal memory
  356.                         allocation parameter.  Entry to a function
  357.                         requires a word on an internal stack, the word
  358.                         is released at function exit.  The value
  359.                         specified is the number of words to allocate.
  360.                         The maximum is 32751 minus the number of
  361.  
  362.  
  363.  
  364.  
  365.                                                           USING THE PROFILER - 4
  366.  
  367.  
  368.  
  369.  
  370.                         functions profiled.  It should only be required
  371.                         if your program uses recursion.   The default
  372.                         value is 10.  If the warning message "Timing
  373.                         may be inaccurate" occurs then this parameter
  374.                         should be used.  It should be set to the
  375.                         maximum level of recursions that can occur at
  376.                         any one time.
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.                                                           USING THE PROFILER - 5
  432.  
  433.  
  434.  
  435.  
  436.                              INPUT/OUTPUT
  437.  
  438.  
  439.      File usage
  440.  
  441.           When the program to be profiled is run only the standard
  442.           Turbo C start up files are open.  The spawn function passes
  443.           these files to the program to be run.  The profiler uses
  444.           stdout and stderr before and after running your program.  Any
  445.           redirection applies to both the profiler and the program
  446.           being profiled.  Delimiter lines are written by the profiler
  447.           to stdout before and after running your program.
  448.  
  449.           Besides the program to be profiled, the .MAP file must be
  450.           available for read only access, this file is not open while
  451.           your program is running.  All file are located via the
  452.           standard DOS path search.
  453.  
  454.  
  455.      Report content
  456.  
  457.           The profile report is written to stdout with a default of 25
  458.           lines to the page, the L option can be used to change the
  459.           default.  If stdout has not been redirected the output will
  460.           pause at the end of each page and you may either display the
  461.           next page or cancel the remaining output, a clear screen is
  462.           issued between each page.  When output has been redirected,
  463.           no pause or clear screen occurs between pages.
  464.  
  465.           Appendix A contains a listing and two reports of a small test
  466.           program.  The first report is by line number.  This report
  467.           exhibits very high profiler overhead since majority of time
  468.           is spent within loops which generate a small number of
  469.           machine instructions per line of C code.  In more realistic
  470.           programs overhead is in the 30% range.  The second report is
  471.           the same program but it was run with the functions only
  472.           option.
  473.  
  474.           Only functions which are compiled with the line number option
  475.           "on" are shown on the report.  The time for functions
  476.           compiled without line numbers are included in the lines of
  477.           your program from where they are called.  As a consequence,
  478.           all the time for the system run time library functions (such
  479.           as printf) will be included in the lines from which they are
  480.           called.  In the test program line 23 took 1 percent of the
  481.           main functions' time, this includes the time it took to
  482.           execute the printf function (with redirection to disk).  On
  483.           the other hand, the time for line 19 only includes the time
  484.           to call and return from test_func, since test_func line
  485.           numbers are included in the map.
  486.  
  487.           The first page of output contains general information about
  488.           the program being profiled.  In reality this may be many
  489.           pages of output since it contains the stdout of the program
  490.           being profiled.  The options section on this page shows all
  491.           the profiler options which were in effect during this
  492.           execution.
  493.  
  494.  
  495.  
  496.  
  497.                                                                 INPUT/OUTPUT - 6
  498.  
  499.  
  500.  
  501.  
  502.           Prior to running your program, the .MAP file is analyzed and
  503.           a table is built in memory.  After this is done the amount of
  504.           memory available to run your program is printed.
  505.  
  506.           The "parameters" line contains the argv[0] to be passed to
  507.           your program, subsequent line(s) contain argv[1] to argv[n]
  508.           parameters each enclosed in quotes.  A line is then output to
  509.           delimit the stdout of your program from that of the profiler,
  510.           it contains the full path and name of the program to be
  511.           executed.  If stdout has not been redirected the profiler
  512.           will pause with a message allowing you to cancel execution or
  513.           run the profile, optionally you may clear the screen prior to
  514.           running your program.
  515.  
  516.           After returning from your program, a line is output giving
  517.           the return code and the calculated time your program would
  518.           have taken if the profiler had not been used.  This time is
  519.           the basis for the percentage calculations made in the body of
  520.           the report.  The next line contains the start date, time, end
  521.           time and the percentage of the elapsed time spent within the
  522.           profiler.
  523.  
  524.           The body of the report starts on the next page.  In Appendix
  525.           A, example 1 is lines within functions, example 2 is a
  526.           functions only report.
  527.  
  528.           Whenever a new module is encountered in the .MAP file a line
  529.           is output with the module name.  When the beginning of a
  530.           function is identified a line is output with the name, the
  531.           percentage of time the function executed as compared to your
  532.           programs total time from page 1 and a graphic representation
  533.           of the percentage.  In addition, for a functions only report
  534.           the count column contains the number of times the function
  535.           was executed, for a lines within function report this count
  536.           appears on the first line within the function.
  537.  
  538.           The line number report has additional information.  The first
  539.           column contains the starting address of the line, the line
  540.           number, the number of times the line was executed, the time
  541.           taken by the line as a percentage of the programs' time, the
  542.           time taken by the line as a percentage of the functions' time
  543.           and a graphic representation of the percentages.
  544.  
  545.           Each column in the graph represents approximately 2.5%.  Four
  546.           characters are used within the graph, asterisks, periods,
  547.           equal signs and dashes.  The asterisks are used for function
  548.           lines only, no other characters appear on these graph lines.
  549.           Even though a report by lines is requested, if a function is
  550.           not executed only the function line will appear on the
  551.           report.  The period only appears in the first column of the
  552.           graph, it is used when a line was executed at least once but
  553.           the time was less than 2.5%.  The end of the equal signs
  554.           represents the lines' time compared to the total time.  The
  555.           end of the dashes represents the lines' time compared to the
  556.           functions' time.
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.                                                                 INPUT/OUTPUT - 7
  564.  
  565.  
  566.  
  567.  
  568.           For the lines within functions report, the format of the
  569.           source file can affect the report.  The listing in Appendix A
  570.           contains some examples which will be referred to in the
  571.           following discussion.  The source for lines 33 and 34, and
  572.           line 39 are essentially the same and generate identical
  573.           machine instructions.  On the other hand, the report is
  574.           different for these two instruction sequences due to the map
  575.           output.  The compiler generates the initialization code of
  576.           the "for loop" and outputs the line address for the .MAP
  577.           file.  Since the calculation is contained on the same line
  578.           nothing is output to the .MAP file for it.  Therefore, line
  579.           39 reports that the line was executed only once and all the
  580.           time for the loop is included with line 39.  In the case of
  581.           lines 33 and 34, the compiler outputs the line 33 address for
  582.           the initialization code and the line 34 address for the
  583.           calculation which shows 19999 executions of the expression.
  584.           In version 2 of Turbo C other loop constructs (while, do) are
  585.           now generated similarly, so that lines 21 and 37 are now
  586.           reported in the same manner as line 39.
  587.  
  588.           All times for the last line of a function are reported with
  589.           the line which called the function.  Therefore for best
  590.           results, the closing bracket of a function should appear on a
  591.           separate line.  The count for the last line of a function is
  592.           correct.
  593.  
  594.           The difference in times between lines 21 and 39 indicate the
  595.           efficiencies of register variables.  In the main function two
  596.           dummy variables were allocated as registers so that the other
  597.           variables, which are used in line 21, could not be
  598.           automatically assigned by the compiler to registers.  In
  599.           test_func the variables for the loop were allocated to
  600.           registers.
  601.  
  602.           In version 2.0 of Turbo C the compiler outputs line numbers
  603.           to the .MAP file for floating point instructions.  Therefore,
  604.           these lines are now reported correctly.
  605.  
  606.           If you are using version 1.5 of Turbo C, lines 41 and 42
  607.           exhibit a problem when using floating point.  If the first
  608.           machine instruction to be generated on a line is for a
  609.           floating point operation the compiler does not output a line
  610.           number for the .MAP file.  Therefore, line 42 does not appear
  611.           in the report and all the time for line 42 is reported in
  612.           line 41.  If you need to see one or more floating point lines
  613.           separately the only option would be to precede each statement
  614.           with a non-floating point statement, such as an increment of
  615.           a dummy integer variable (better yet, upgrade to version 2,
  616.           it's worth it).
  617.             Example:  dummy++; r = a * b;  /* on one line */
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.                                                                 INPUT/OUTPUT - 8
  630.  
  631.  
  632.  
  633.  
  634.                              MEMORY USAGE
  635.  
  636.  
  637.      Lines within functions
  638.  
  639.           "Memory required" =
  640.           16 * "number of lines mapped" +
  641.           2  * ("number of functions within the line map" +
  642.                 "value of -S option") +
  643.           13 * "number of modules within the line map" +
  644.           "your program requirements" + 39k
  645.  
  646.  
  647.      Functions only
  648.  
  649.           "Memory required" =
  650.           16 * "number of functions within the line map" * 2 +
  651.           2  * ("number of functions within the line map" +
  652.                 "value of -S option") +
  653.           13 * "number of modules within the line map" +
  654.           "your program requirements" + 39k
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.                                                                 MEMORY USAGE - 9
  696.  
  697.  
  698.  
  699.  
  700.                             ERROR MESSAGES
  701.  
  702.  
  703.           Return
  704.           Code    Message
  705.  
  706.           35      DOS version must be 3.0 or later.
  707.  
  708.           36      Parameter invalid in response file.
  709.  
  710.           37      File not found (.exe and .map required).
  711.  
  712.           38      Invalid map file, no line numbers.
  713.                   In the chapter "INTRODUCTION" see section "Compiler
  714.                   and execution requirements".
  715.  
  716.           39      Insufficient memory.
  717.  
  718.           40      Logic.
  719.                   This message is accompanied by other information.  If
  720.                   it should occur please notify me, giving the full
  721.                   message displayed, details of your system and compile
  722.                   options used on the program being profiled.
  723.  
  724.           41      Not a Turbo C program.
  725.  
  726.           42      Invalid map file, no public values found.
  727.                   Refer to the section "Compiler and execution
  728.                   requirements".
  729.  
  730.           43      NOTE:  Timing inaccurate, see -S in documentation.
  731.                   Refer to the section "Profiler options".
  732.  
  733.           44      NOTE:  Timing inaccurate, see caveats in
  734.                   documentation.
  735.                   See the discussion on static functions under
  736.                   "Restrictions and caveats".
  737.  
  738.           99      Parameter display or error.
  739.  
  740.                   All return codes below 35 are identical to the errno
  741.                   values used by Turbo C.
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.                                                              ERROR MESSAGES - 10
  762.  
  763.  
  764.  
  765.  
  766.                                    APPENDIX A
  767.  
  768.  
  769.                              ---------------------------------
  770.                                    LISTING 1
  771.                              ---------------------------------
  772.  
  773.            1  #include <stdio.h>
  774.            2  #include <stdlib.h>
  775.            3
  776.            4
  777.            5
  778.            6
  779.            7  /*      Prototype Definitions      */
  780.            8  void test_func(void);
  781.            9  /* End Prototypes  */
  782.           10
  783.           11  #define LOOP_CNT 20000
  784.           12
  785.           13  main()
  786.           14  {
  787.           15  register int reg_si, reg_di; /* dummy variables to use up regs */
  788.           16  int a = 10;
  789.           17  int i = LOOP_CNT;
  790.           18
  791.           19    test_func();
  792.           20
  793.           21    while (--i) a = a * a / a;
  794.           22
  795.           23    printf("Proftest executed");
  796.           24    return (0);
  797.           25  }                  /*     end of main     */
  798.           26
  799.           27  void test_func(void)
  800.           28  {
  801.           29  register unsigned int i;
  802.           30  register unsigned int a = 10;
  803.           31  float b, c;
  804.           32
  805.           33    for (i = LOOP_CNT; --i;)
  806.           34      a = a * a / a;
  807.           35
  808.           36    i = LOOP_CNT;
  809.           37    while (--i) a = a * a / a;
  810.           38
  811.           39    for (i = LOOP_CNT; --i;) a = a * a / a;
  812.           40
  813.           41    for (i = 50, b = 10.0; i > 0; i--)
  814.           42      c = b * b / b;
  815.           43  }                /* end of test_func */
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.                                                                  APPENDIX A - 11
  828.  
  829.  
  830.  
  831.  
  832.                             ----------------------------------
  833.                                    EXAMPLE 1
  834.                             ----------------------------------
  835.  
  836.                          Turbo C Profiler (TCPROF V1.5)                    1
  837.  
  838. PROFILER OPTIONS:
  839.   Minimum line count printed(-C) 0:  Lines per page(-L) 58
  840.   Internal stack size(-S) 10 default
  841.  
  842. Analyzing C:\C\PROFTEST.MAP
  843. 18 lines in 2 functions in 1 module will be profiled
  844.  
  845. Building profile table
  846. Memory available 437432 bytes
  847.  
  848. Parameters:  C:\C\PROFTEST.EXE
  849.  
  850. ***** STDOUT FOR C:\C\PROFTEST.EXE *****
  851. Proftest executed
  852.  
  853. *** End of Program Output  Return code 0  Time mm:ss 0:03 ***
  854. Start 9-25-1988 16:41:26.67  End 16:41:42.22  Profiler overhead 84%
  855.  
  856.    --------   Example 1 Page 1:   tcprof -L proftest >proftest.ex1   --------
  857.  
  858.  
  859.  
  860.  
  861.  
  862. PROFTEST.EXE             Turbo C Profiler (TCPROF V1.5)                    2
  863. Func/Addr   Line   Count      %Tot %Fun...1...2...3...4...5...6...7...8...9...
  864.  
  865. MODULE PROFTEST
  866.  
  867. main                           36      ***************
  868. 0000:01FA   13     1            0    0 .
  869. 0000:0202   16     1            0    0 .
  870. 0000:0207   17     1            0    0 .
  871. 0000:020C   19     1            0    0 .
  872. 0000:020F   21     1           36   99 ==============--------------------------
  873. 0000:0229   23     1            0    1 .
  874. 0000:0232   24     1            0    0 .
  875. 0000:0236   25     1            0    0 .
  876.  
  877. test_func                      64      *************************
  878. 0000:023C   27     1            0    0 .
  879. 0000:0244   30     1            0    0 .
  880. 0000:0247   33     1            0    0 .
  881. 0000:024C   34     19999       21   33 ========-----
  882. 0000:025D   36     1            0    0 .
  883. 0000:0260   37     1           18   28 =======----
  884. 0000:0273   39     1           18   28 =======----
  885. 0000:0289   41     1            0    0 .
  886. 0000:0299   42     50           7   11 ===-
  887. 0000:02B6   44     1            0    0 .
  888.  
  889.  
  890.  
  891.  
  892.  
  893.                                                                  APPENDIX A - 12
  894.  
  895.  
  896.  
  897.  
  898. *** End of profile report for C:\C\PROFTEST.EXE ***
  899.  
  900.    --------   Example 1 Page 2:   tcprof -L proftest >proftest.ex1   --------
  901.  
  902.                        ----------------------------------
  903.                                    EXAMPLE 2
  904.                        ----------------------------------
  905.  
  906.                          Turbo C Profiler (TCPROF V1.5)                    1
  907.  
  908. PROFILER OPTIONS:
  909.   FUNCTIONS ONLY(-F):  Lines per page(-L) 58
  910.   Internal stack size(-S) 10 default
  911.  
  912. Analyzing C:\C\PROFTEST.MAP
  913. 2 functions in 1 module will be profiled
  914.  
  915. Building profile table
  916. Memory available 437656 bytes
  917.  
  918. Parameters:  C:\C\PROFTEST.EXE
  919.  
  920. ***** STDOUT FOR C:\C\PROFTEST.EXE *****
  921. Proftest executed
  922.  
  923. *** End of Program Output  Return code 0  Time mm:ss 0:03 ***
  924. Start 9-25-1988 16:42:58.56  End 16:43:02.08  Profiler overhead 12%
  925.  
  926.    -------   Example 2 Page 1:   tcprof -L -F proftest >proftest.ex2  -------
  927.  
  928. PROFTEST.EXE             Turbo C Profiler (TCPROF V1.5)                    2
  929. Func/Addr   Line   Count      %Tot %Fun...1...2...3...4...5...6...7...8...9...
  930.  
  931. MODULE PROFTEST
  932.  
  933. main               1           38      ***************
  934. test_func          1           62      *************************
  935.  
  936. *** End of profile report for C:\C\PROFTEST.EXE ***
  937.  
  938.    -------   Example 2 Page 2:   tcprof -L -F proftest >proftest.ex2  -------
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.                                                                  APPENDIX A - 13
  960.  
  961.  
  962.  
  963.  
  964.                               APPENDIX B
  965.  
  966.  
  967.      Registered user information
  968.  
  969.           A registered users version of this program, TCPROFRU, is
  970.           available for $20.00 ($25.00 for 3 1/2" diskettes).  Please
  971.           use the order form at the end of this document.
  972.  
  973.           The registered user version has additional options which
  974.           allow you to tailor the amount of information gathered by the
  975.           program.  On larger programs this reduces the overhead of the
  976.           profile runs and the size of the report.
  977.  
  978.  
  979.      Registered user features
  980.  
  981.           -A[-]func-nm  Alter the treatment of the named function.
  982.  
  983.                         If the profiler is being run in the default
  984.                         mode of lines by function, each function named
  985.                         by this option will NOT have line numbers
  986.                         traced.  A single line, as for a functions only
  987.                         report, is output for each named function.
  988.  
  989.                         If the functions only option is "on" (-F) then
  990.                         the named functions will have line number
  991.                         tracing on.
  992.  
  993.                         For either case above, if a minus sign precedes
  994.                         the named function it will not be traced and
  995.                         all times for the function will be included in
  996.                         the lines or functions that call it.
  997.  
  998.                         Multiple A options may be used.  The function
  999.                         name is case sensitive.
  1000.  
  1001.                           Ex:  tcprofru -F -Afn1 -A-fn2 tstprg
  1002.                         Functions only plus fn1 lines and no trace on
  1003.                         fn2.
  1004.  
  1005.           -M[-]mod-nm   Alter the treatment of all functions in the
  1006.                         named module.
  1007.  
  1008.                         Depending on the status of the F switch the
  1009.                         treatment of all functions within the named
  1010.                         module will be modified.  This is a shorthand
  1011.                         method of altering(A[]) the treatment of all
  1012.                         the functions in a module.
  1013.  
  1014.                         Multiple M options may be used.  The module
  1015.                         name is not case sensitive.
  1016.  
  1017.                           Ex:  tcprofru -Mmod1 -M-mod2 testprog
  1018.                         Profile functions only in mod1, no profile of
  1019.                         functions in mod2, all other functions are
  1020.                         profiled by line.
  1021.  
  1022.  
  1023.  
  1024.  
  1025.                                                                  APPENDIX B - 14
  1026.  
  1027.  
  1028.  
  1029.  
  1030.           -F[-][+]      Alter the treatment of all functions in the
  1031.                         program.
  1032.  
  1033.                         The -F- option causes all functions to be
  1034.                         skipped except those specified by A or M
  1035.                         options.  The functions included by a -A or -M
  1036.                         option are profiled by line unless the name is
  1037.                         preceded by a -, in which case a single line
  1038.                         per function is reported.  This is convenient
  1039.                         when only a few functions in a large program
  1040.                         needs to be profiled.
  1041.  
  1042.                         The -F+ option resets the default, profile by
  1043.                         line.  It would be used if a response file (-@
  1044.                         option) contains a -F option and you wish to
  1045.                         override it. The last -F option encountered on
  1046.                         the command line is the one in effect for all
  1047.                         functions.
  1048.  
  1049.                         The interaction between the -F, -M and -A
  1050.                         options result in 27 possibilities.  The table
  1051.                         below is taken from the help screen of
  1052.                         TCPROFRU.
  1053.  
  1054.           -F[-][+]     |     No or +     |       Yes       |      with -     |
  1055.           -M[-]module  |  N  |  Y  |  -  |  N  |  Y  |  -  |  N  |  Y  |  -  |
  1056.           -A[-]function|N Y -|N Y -|N Y -|N Y -|N Y -|N Y -|N Y -|N Y -|N Y -|
  1057.               resulting L F S F L S S L F F L S L F S S L F S L F L F S F L S
  1058.                 profile: L = lines; F = function; S = skip, add time to caller
  1059.  
  1060.                         The second, third and fourth columns are
  1061.                         interpreted as follows:  N means that the
  1062.                         option not used for a particular module or
  1063.                         function.  Y means that the option was used for
  1064.                         a particular module or function.  The - means
  1065.                         that a particular module or function was
  1066.                         preceded by a minus.
  1067.  
  1068.                           Ex: tcprofru -M-module1 -Amod1fn2
  1069.                         Refering to the preceding table:  The
  1070.                         "resulting profile" line gives the effect for a
  1071.                         particular function.  the effect on functions
  1072.                         mod1fn1 and mod1fn2 in module1 is:  No -F
  1073.                         option therefore, select -F column 1; -M-
  1074.                         specified for module1 therefore, select -M
  1075.                         column 3; for mod1fn1 -A was not specified
  1076.                         therefore, select -A column 7 which results in
  1077.                         this function not appearing in the report and
  1078.                         its time being added to the caller.  On the
  1079.                         other hand, mod1fn2 is specified by a -A option
  1080.                         which selects -A column 8 and results in each
  1081.                         line of the function being profiled.
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.                                                                  APPENDIX B - 15
  1092.  
  1093.  
  1094.  
  1095.  
  1096.                           Ex:  tcprofru -F- -Afn1 -M-mod2 tstprg
  1097.                         The -F- option turns off profiling of all
  1098.                         functions in the program.  The -A and -M
  1099.                         options then modify this action as follows:
  1100.                         Profile by lines function fn1, one line per
  1101.                         function will be profiled for the functions in
  1102.                         module mod2, all other function times are
  1103.                         included with the caller's.
  1104.  
  1105.  
  1106.           -PnnF&|T      Only print lines whose percentage exceeds nn.
  1107.  
  1108.                         F = Line's percentage of function:  T = Line's
  1109.                         percentage of total. If both are specified the
  1110.                         line is printed if either percentage exceeds
  1111.                         the nn value.  If both are to be the same
  1112.                         percentage it may be specified as P20FT.
  1113.  
  1114.                           Ex:  tcprofru -P50F -p10t tstprg
  1115.                         Only print lines, which are 50% or more of the
  1116.                         function or are 10% or more of the total.
  1117.  
  1118.           -I[-]         Include C source in the report.
  1119.  
  1120.                         This option interleaves the C source code with
  1121.                         the report.  For each C module encountered in
  1122.                         the .MAP file a standard DOS path search is
  1123.                         made.  If the source code is found it is
  1124.                         printed with the report.  The -I- option can be
  1125.                         used to override a -I specified in a response
  1126.                         file (-@ option).
  1127.  
  1128.           -@file-name   Merge the named file with the command line
  1129.                         options.
  1130.  
  1131.                         When the @ option is encountered on the command
  1132.                         line the file is opened and each line within
  1133.                         the file is treated as one profiler command
  1134.                         line parameter.  The response file cannot be
  1135.                         used to specify the program to be profiled or
  1136.                         it's options.  The options must be in the same
  1137.                         sequence as they would appear on the command
  1138.                         line.  An @ option may not be contained within
  1139.                         the file.  Multiple @ options may be used on
  1140.                         the command line.
  1141.  
  1142.                           Ex: tcprofru -@op.dat -Aadd_fn tstprg
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.                                                                  APPENDIX B - 16
  1158.  
  1159.  
  1160.  
  1161.  
  1162.                               APPENDIX C
  1163.  
  1164.  
  1165.      PROBLEM REPORT/SUGGESTIONS
  1166.  
  1167.                                                      TCPROF version 1.5
  1168.           From:  Name:             ___________________________________
  1169.  
  1170.                  Company:          ___________________________________
  1171.  
  1172.                  Address:          ___________________________________
  1173.  
  1174.                  City, State, Zip: ___________________________________
  1175.  
  1176.           Received program from: _____________________________________
  1177.  
  1178.           Hardware:          _________________________________________
  1179.  
  1180.           Operating system:  ________________________  version: ______
  1181.  
  1182.           Resident programs: _________________________________________
  1183.  
  1184.                             __________________________________________
  1185.  
  1186.           Error message (if problem report):
  1187.  
  1188.              _________________________________________________________
  1189.  
  1190.           Description of error or suggestions:
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.           If appropriate and available, printed output of the profile
  1208.           report and a listing of the program or a fragment
  1209.           illustrating the problem would be helpful.
  1210.  
  1211.           Mail to:
  1212.                               Mr. Andre Nancoz
  1213.                               349 Quincy Ave.
  1214.                               Bronx, NY 10465
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.      REGISTERED USER ORDER FORM
  1221.  
  1222.           Mail to:
  1223.                               Mr. Andre Nancoz
  1224.                               349 Quincy Ave.
  1225.                               Bronx, NY 10465
  1226.  
  1227.             ..........................................................
  1228.  
  1229.             Order for TC profiler registered users version (TCPROFRU):
  1230.  
  1231.           Name:             __________________________________________
  1232.  
  1233.           Company:          __________________________________________
  1234.  
  1235.           Address:          __________________________________________
  1236.  
  1237.           City, State, Zip: __________________________________________
  1238.  
  1239.  
  1240.           Received TCPROF program from:
  1241.  
  1242.             __________________________________________________________
  1243.  
  1244.  
  1245.           Hardware:          _________________________________________
  1246.  
  1247.  
  1248.           Operating system:  ________________________  version: ______
  1249.  
  1250.           Send:
  1251.  
  1252.              ___ copies of 5 1/4" DSDD at $20.00 each ________
  1253.  
  1254.              ___ copies of 3 1/2" DSDD at $25.00 each ________
  1255.  
  1256.                                      Total enclosed. $________
  1257.             Checks only.  U. S. funds.  NO COD.
  1258.  
  1259.